package com.huasan.www.demon.data.service.impl;
import com.huasan.www.demon.util.OnePage;
import com.huasan.www.demon.util.Page;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huasan.www.demon.data.dao.AccountinfoMapper;
import com.huasan.www.demon.data.service.AccountinfoService;
import com.huasan.www.demon.pojo.Accountinfo;
import com.huasan.www.demon.pojo.AccountinfoExample;
import com.huasan.www.demon.pojo.SumAccountStatus;

import java.util.List;

import org.apache.ibatis.annotations.Param;

@Service("accountinfoService")
public class AccountinfoServiceImpl implements AccountinfoService{
	
    @Autowired
    private AccountinfoMapper accountinfoDao;    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int countByExample(AccountinfoExample example){
      return accountinfoDao.countByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int deleteByExample(AccountinfoExample example){
      return accountinfoDao.deleteByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int deleteByPrimaryKey(Long id){
      return accountinfoDao.deleteByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int insert(Accountinfo record){
      return accountinfoDao.insert(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int insertSelective(Accountinfo record){
      return accountinfoDao.insertSelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public List<Accountinfo> selectByExample(AccountinfoExample example){
      return accountinfoDao.selectByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public Accountinfo selectByPrimaryKey(Long id){
      return accountinfoDao.selectByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByExampleSelective(@Param("record") Accountinfo record, @Param("example") AccountinfoExample example){
      return accountinfoDao.updateByExampleSelective(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByExample(@Param("record") Accountinfo record, @Param("example") AccountinfoExample example){
      return accountinfoDao.updateByExample(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByPrimaryKeySelective(Accountinfo record){
      return accountinfoDao.updateByPrimaryKeySelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table accountinfo
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByPrimaryKey(Accountinfo record){
      return accountinfoDao.updateByPrimaryKey(record);
    }
    
    public List<SumAccountStatus> selectGroupByStatusExample(AccountinfoExample example){
    	return accountinfoDao.selectGroupByStatusExample(example);
    }
    
    public List<SumAccountStatus> selectGroupByOptExample(AccountinfoExample example){
    	return accountinfoDao.selectGroupByOptExample(example);
    }

    public OnePage<Accountinfo> selectOnePageByExample(AccountinfoExample example){
    	int count = accountinfoDao.countByExample(example);
    	List<Accountinfo> dataList = accountinfoDao.selectByExample(example);
    	OnePage<Accountinfo> onepage = new OnePage<Accountinfo>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
    	return onepage;
    }
}